
#pragma once

#include "Widget.h"

static const u_int uBUTTON_HORZ_TEXT_MARGIN = 8;

typedef void(*ButtonPressCallback)(void* pUserData);

class Button : public Widget
{
	public:

		Button( Widget* pxParent );
		virtual ~Button();
	
		virtual void Render( );
		virtual void Update( );

		virtual bool CanHaveChildren( ) { return false; }

		virtual void SetButtonPressCallback( ButtonPressCallback pfnCallback, void* pCallbackUserData );

		virtual void SetLabel( const char* szText );
		virtual const char*	GetLabel( )						{ return m_szText; }

		virtual void SetEnabled( const bool bEnabled );

		virtual void SetImage( const StringHash xHash );
		virtual void SetImageMargin( u_int uMargin ) { m_uImageMargin = uMargin; }

		virtual void SetFlatStyle( bool bFlatStyle ) { m_bFlatStyle = bFlatStyle; }
		virtual void SetRenderArrow( bool bRenderArrow ) { m_bRenderArrow = bRenderArrow; }
		virtual void SetCentreAlignText( bool bCentreAlign ) { m_bCentreAlignText = bCentreAlign; }

		virtual void SetBorderWidth( float fWidth ) { m_fBorderWidth = fWidth; }
	
		virtual bool GetIsPressed() { return m_bIsPressed; };

	protected:

		char m_szText[64];

		ButtonPressCallback	m_pfnCallback;
		void* m_pCallbackUserData;
		float m_fHoverTimer;
		StringHash m_xImage;
		u_int m_uImageMargin;

		float m_fBorderWidth;
		bool m_bEnabled;
		bool m_bFlatStyle;
		bool m_bRenderArrow;
		bool m_bIsPressed;
		bool m_bCentreAlignText;
};

//eof
